//---------------------------------------------------------------------------- // File: C3DCamera.h // Class: C3DVCamera -- Common 3D Camera system. // Type: 3D Object // Author: Ken Anderson // Date: 11/25/04 // OS dependant: NA // Desc: A class designated to an object that manages the system camera. // Version: 1.0 -- Basic camera to be upgraded for better performance in the future. // // Required headers: // 1) C3DTypes.h -- Contains 3D structures and typedefinitions the camera object requires. // 2) C3DMath.h -- Contains Common 3D Mathematical definitions. // 3) C3DVector.h -- Contains a class that manages the set of vectors. // 4) CRSGlobal.h -- The Global CRS Manager to access. //---------------------------------------------------------------------------- #ifndef __C3DCAM__ #define __C3DCAM__ #include "C3DVector.h" #include "CRSGlobal.h" typedef enum { CT_STATIC, CT_MOTION, CT_PANERAMIC, CT_FISHEYE, } C3DCameraType; class C3DCamera { private: //Camera Orientation. C3DVector3 m_Eye; C3DVector3 m_Position; C3DVector3 m_Up; //Perspective features float m_fFOV; //Field of Vision. float m_fAspect; //Aspect ratio. float m_fNear; //Near clipping plane. float m_fFar; //Far clipping plane. //Type of Camera C3DCameraType m_Type; //Dynamic Camera movements. float m_fYaw; //Direction of camera's movement along x & z axis. (Left or Right movement) float m_fPitch; //Direction of camera's movement along the y axis. (Up or Down movement) float m_fTilt; //Direction of camera's movement along x & y or x & z.(Roll left or right) float m_fPitchLimit; //Limitation of the Pitch, up and down movement. float m_fTiltLimit; float m_fSpeed; //Speed of the camera's movements. int m_nYawHold; int m_nPitchHold; int m_nThrustHold; int m_nTiltHold; public: //Construct & Destructors. C3DCamera(C3DCameraType Type=CT_STATIC); C3DCamera(float fYaw, float fPitch, float fTilt); C3DCamera(float fFOV, float fAspect, float fNear, float fFar, C3DCameraType Type=CT_STATIC); C3DCamera(float x, float y, float z, C3DCameraType Type=CT_STATIC); C3DCamera(const C3DCamera& camera); ~C3DCamera(){}; //Camera Orientation C3DVector3 RetrieveEye(); C3DVector3 RetrievePosition(); C3DVector3 RetrieveUp(); void SetEye(float x, float y, float z) {m_Eye.x = x;m_Eye.y=y;m_Eye.z=z;} void SetEye(C3DVector3 v){m_Eye = v;} void SetPosition(float x, float y, float z) {m_Position.x = x;m_Position.y=y;m_Position.z=z;} void SetPosition(C3DVector3 v){m_Position = v;} void SetUp(float x, float y, float z) {m_Up.x = x;m_Up.y=y;m_Up.z=z;} void SetUp(C3DVector3 v){m_Up = v;} //Return the prespectives float RetrieveFOV(){return m_fFOV;} float RetrieveAspect(){return m_fAspect;} float RetrieveNear(){return m_fNear;} float RetrieveFar(){return m_fFar;} //Set the perspective void SetFOV(float fFOV){m_fFOV = fFOV;} void SetAspect(float fAspect){m_fAspect = fAspect;} void SetNear(float fNear){m_fNear = fNear;} void SetFar(float fFar){m_fFar = fFar;} //////////////// // Movement // //////////////// //Update the camera to turn left or right. float RetrieveYaw(){return m_fYaw;} void SetYaw(float fYaw){m_fYaw = fYaw;} void YawLeft(float fYaw){m_fYaw += fYaw;} void YawRight(float fYaw){m_fYaw -= fYaw;} void YawHold(SByte nHold){m_nYawHold = nHold;} //Update the camera to look up or down. float RetrievePitch(){return m_fYaw;} void SetPitch(float fPitch){m_fPitch = fPitch;} void SetPitchLimit(float fLimit){m_fPitchLimit = fLimit;} void PitchUp(float fPitch){m_fPitch += fPitch;} void PitchDown(float fPitch){m_fPitch -= fPitch;} void PitchHold(SByte nHold){m_nPitchHold = nHold;} //Update the camera to roll left or right. float RetrieveTilt(){return m_fTilt;} void SetTilt(float fTilt){m_fTilt = fTilt;} void SetTiltLimit(float fLimit){m_fTiltLimit = fLimit;} void TiltLeft(float fTilt){m_fTilt -= fTilt;} void TiltRight(float fTilt){m_fTilt += fTilt;} void TiltHold(SByte nHold){m_nTiltHold = nHold;} //Move the camera forward or backwards in the direction //the camera is pointing. void SetSpeed(float Speed){m_fSpeed = Speed;} void MoveFoward(float fMove){m_Position += m_Eye;} void MoveReverse(float fMove){m_Position -= m_Eye;} void ThrustHold(SByte nHold){m_nThrustHold = nHold;} void Render(float fTimeIndex); private: void Init(float x, float y, float z); void CalcVectors(float fTimeIndex); }; #endif